package com.sure.supermarketserver.sell.vip;

import com.sure.supermarketserver.common.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/sell/vip")
public class VipAPI {

    @Resource
    private VipService vipService;

    //查询
    @GetMapping("")
    public Result vipList(VipDto dto){
        Map<String, Object> page = vipService.getVipList(dto);
        return Result.success(page);
    }

    //增加
    @PostMapping("")
    public  Result vipAdd(@RequestBody VipDto dto){
        vipService.addVip(dto);
        return  Result.success();
    }

    //修改
    @PutMapping("")
    public  Result vipUpdate(@RequestBody VipDto dto){
        vipService.updateVip(dto);
        return  Result.success();
    }

    //删除
    @DeleteMapping("/{id}")
    public  Result vipDelete(@PathVariable Integer id){
        vipService.deleteVip(id);
        return  Result.success();
    }

}